﻿using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Input;

namespace GaleSong
{
    // 树形Menu，通过BasePart指定父节点，PrevPart/NextPart指定兄弟节点
    [Part()]
    public class MainPart : PartBase
    {
        public MainPart()
            : base(Constant.FilePart)
        {
        }
    }

    [Part(BasePart = Constant.FilePart)]
    public class AddPart : PartBase
    {
        public AddPart()
            : base(Constant.AddPart)
        {
        }
    }

    [Part(BasePart = Constant.AddPart)]
    public class AddNewPart : PartBase
    {
        public AddNewPart()
            : base(Constant.AddNewPart)
        {
        }
    }

    [Part(BasePart = Constant.AddPart)]
    public class AddExistingPart : PartBase
    {
        public AddExistingPart()
            : base(Constant.AddExistingPart)
        {
        }
    }

    [Part(BasePart = Constant.FilePart)]
    public class ExitPart : PartBase
    {
        public ExitPart()
            : base(Constant.ExitPart)
        {
        }

        public override void Execute()
        {
            Application.Current.Shutdown();
        }
    }


    [Part()]
    public class HelpPart : PartBase
    {
        public HelpPart()
            : base(Constant.HelpPart)
        {
        }
    }
    [Part(BasePart = Constant.HelpPart)]
    public class LanguagePart : PartBase
    {
        public LanguagePart()
            : base(Constant.LanguagePart)
        {
        }
    }

    [Part(BasePart = Constant.LanguagePart)]
    public class ChinesePart : PartBase
    {
        public ChinesePart()
            : base(Constant.ChinesePart)
        {
        }

        public override void Execute()
        {
            IoC.Get<IResourceService>().ChangeLanguage("zh-cn");
        }
    }

    [Part(BasePart = Constant.LanguagePart)]
    public class EnglishPart : PartBase
    {
        public EnglishPart()
            : base(Constant.EnglishPart)
        {
        }

        public override void Execute()
        {
            IoC.Get<IResourceService>().ChangeLanguage("en-us");
        }
    }
}